package com.ylx.code.bo;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Objects;

/**
 * 基础分页查询类
 * @author yanglixin2
 */
@Data
public class BasePageBo {

    @ApiModelProperty(value = "当前页码 默认为1")
    private Integer current;
    @ApiModelProperty(value = "当前页面大小 默认为10")
    private Integer size;

    public Integer getSize() {
        if (Objects.isNull(this.size) || this.size == 0) {
            return 10;
        }
        return this.size;
    }

    public Integer getCurrent() {
        if (Objects.isNull(this.current) || this.current == 0) {
            return 1;
        }
        return this.current;
    }
    
    
    public Page buildPage() {
		return new Page(getCurrent(), getSize());
	}
    
}
